using System.Collections.Generic;
namespace System.Net.DnsToolkit.Util {

    public static class Enum<T> {

        public static T Parse(string value) {
            return (T)Enum.Parse(typeof(T), value);
        }

        public static IList<T> GetValues() {
            var list = new List<T>();
            foreach (var value in Enum.GetValues(typeof(T))) {
                list.Add((T)value);
            }
            return list;
        }

        public static T ToObject(int value) {
            var t = (T)Enum.ToObject(typeof(T), value);
            return t;
        }
    }
}